<?php 

$username="LILI";


echo "PPPP $username PPPP   ";

$a=5;
$b=6;/*
$c=$a+$b;
echo $c;

$b+=$a;
echo " ";
echo $b;
*/

$a=++$b;
//$a=$b++;
echo $a;
echo" $b ";

if($a<>$b){
    echo"ok" ;
}else{
    
    echo"no" ;
}

$i=7;
if($i==5){
    echo"51";
}elseif ($i==2){
    echo"2";
    
}elseif ($i==3) {
    echo"3";
    ;
}elseif($i==7){
    echo"ok";
    
}
function vd($param) {
    echo"\n------".gettype($param)."---------\n";
    echo $param;
    
}
vd(htmlentities('<strong>我是吴祁！</strong>'));//转换所有字符

vd(htmlspecialchars('<strong>我是吴祁！</strong>')) ; //转换特殊字符
vd(strip_tags('<strong>我是吴祁！</strong>'));  //去掉了<strong>

echo addslashes('This is \a" Teacher! ');
echo strtoupper('yc60.com@gmail.com');
echo str_pad('Salad',10).'is good.';

$email = 'yc60.com@gmail.com';
$email_array  = explode('@',$email);
print_r($email_array);


$str = "I,will.be#back";
$tok = strtok($str,",.#"); 
    echo "$tok<br \>";
while($tok) {
    echo "$tok<br \>";
    $tok = strtok(",.#");
}
echo substr("abcdef", 1, 3);
echo mb_substr("我爱祖国,祖国爱我", 1, 3,encoding: "utf8");
print_r(str_split('This is a Teacher!',5));
#str_split函数,分割字符串, 第二个参数是长度

echo strrev('This is a Teacher!');
#字符串反转
print(strcmp('a','b'));
print(strcmp('a', 'A'));
print(strcasecmp('a', 'A'));
print(strcmp('11', '2'));
print(strnatcmp('11', '2'));
print(strnatcasecmp('A11', 'a2'));
#如果要区分大小要用strnatcasecmp 和stnatcsercmp
#更符合自然

print("\n");
print(strspn('gmail','yc60.com@gail.co'));
print("\n");
print("\n");
print( strspn("49 is the answer to the 128th question.", "1234567890"));
print("\n");
print("\n");
print( strspn("我爱祖国,5祖国爱我", "我爱祖国,"));
print("\n");
print("\n");
print(strlen('This is a Teacher!'));
print("\n");
print(strlen('我爱祖国,'));
print("\n");
print(mb_strlen('我爱祖国,'));
print("\n");

print( substr_count('yc60.com@gmail.com','c'));
print("\n");
print( substr_count('爱我爱爱我爱祖爱国','爱'));
print(str_shuffle("yc60.com@gail.co"));
print("\n");
print(strstr('yc60.com@gmai@l.com','@'));
print("\n--");
print(mb_strstr('爱我爱爱我爱祖爱国','我'));
#返回找到部分以及至结尾

#"delivery"、"Delivery"和"DELIVERY"。
print(".\n");
print(stristr('yc60.coDeliverym@gmai@l.com','delivery'));
print(".\n");
print(strchr('yc60.com@gmai@l.com','@'));
print("\n");
print(strrchr('yc60.com@gmai@l.com','@'));

print("\n");
print(strpos('yc60.com@gmail.com','c'));
print(strpos('爱我爱爱我爱祖爱国','我'));
print("\n");
print(strrpos('yc60.com@gmail.com','c'));
print("\n");
print(str_replace('@','#','yc60.com@gmail.com'));
print("\n");
print(substr_replace('yc60.com@gmail.com',"DDDD",1,5));
print("\n");
print(str_ireplace('Y','#','yc60.com@gmail.com'));
print("\n");
$language = array('php','asp','jsp','python','ruby');
print_r(preg_grep('/p$/',$language));
#print

 print(preg_match('/php[2-9]/', 'php5'));


 preg_match_all('/php[5-8]/','php8sdfphp7sdflljkphp3sdlfjphp2',$out);
print("\n");
 print_r($out);
 
print("\n");
print( preg_quote('PHP的,$ ^ * () + = {} [] | \\ : <>;价格是：$150'));


$mode = '/\[b\](.*)\[\/b\]/U';
$replace = '<strong>\1</strong>';
$string = 'This is a [b]php7[/b],This is a [b]php8[/b]';
print( preg_replace($mode,$replace,$string));




// 现在想使其能用于 2003 年
$text = "April fools day is 04/01/2002\n";
$text.= "Last christmas was 12/24/2001\n";

// 回调函数
function next_year($matches) {
    // 通常：$matches[0] 是完整的匹配项
    // $matches[1] 是第一个括号中的子模式的匹配项
    // 以此类推
    return ($matches[2]+1)."/".$matches[1];
}

print( preg_replace_callback( "|(\d{2}/\d{2})/(\d{4})|",
        "next_year",$text));

// 结果为：
// April fools day is 04/01/2003
// Last christmas was 12/24/2002


print_r(preg_split('/[\.@]/','yc60.com@gmail.com'));


?>